#include "DXUT.h"
#include "Vertex.h"
const char* VERTEXTYPENAME[] =
{
	"VT_POS",
	"VT_POSNORM", 
	"VT_POSNORMUV", 
	//"", 
	"VT_POSNORMUVTANG", 
	"VT_POSNORMUVTANG_SKIN",
};

const D3D11_INPUT_ELEMENT_DESC Vertex::layout[1] =
{
	{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0,  0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
const D3DVERTEXELEMENT9 Vertex::VERTEX_DECL[] =
{
	{ 0,  0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT,  D3DDECLUSAGE_POSITION, 0},
	D3DDECL_END()
};

enum VERTEXTYPE Vertex::VType = VERTEXTYPE::VT_POS;
const unsigned int Vertex::STRIDE_SIZE = sizeof(D3DXVECTOR3);


const D3D11_INPUT_ELEMENT_DESC VertexNorm::layout[2] =
{
	{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0,  0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	{ "NORMAL",   0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },	
};
const D3DVERTEXELEMENT9 VertexNorm::VERTEX_DECL[] =
{
	{ 0,  0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT,  D3DDECLUSAGE_POSITION, 0},
	{ 0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT,  D3DDECLUSAGE_NORMAL,   0},	
	D3DDECL_END()
};
const unsigned int VertexNorm::STRIDE_SIZE = sizeof(D3DXVECTOR3)*2;
enum VERTEXTYPE VertexNorm::VType = VERTEXTYPE::VT_POSNORM;


const D3D11_INPUT_ELEMENT_DESC VertexNormUV::layout[3] =
{
	{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0,  0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	{ "NORMAL",   0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT,    0, 24, D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
const D3DVERTEXELEMENT9 VertexNormUV::VERTEX_DECL[] =
{
	{ 0,  0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT,  D3DDECLUSAGE_POSITION, 0},
	{ 0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT,  D3DDECLUSAGE_NORMAL,   0},
	{ 0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT,  D3DDECLUSAGE_TEXCOORD, 0},
	D3DDECL_END()
};
const unsigned int VertexNormUV::STRIDE_SIZE = sizeof(D3DXVECTOR3)*2+sizeof(D3DXVECTOR2);
enum VERTEXTYPE VertexNormUV::VType = VERTEXTYPE::VT_POSNORMUV;


const D3D11_INPUT_ELEMENT_DESC VertexNormUVTang::layout[5] =
{
	{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0,  0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	{ "NORMAL",   0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT,    0, 24, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	{ "TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT,    0, 32, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	{ "BINORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT,    0, 44, D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
const D3DVERTEXELEMENT9 VertexNormUVTang::VERTEX_DECL[] =
{
	{ 0,  0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT,  D3DDECLUSAGE_POSITION, 0},
	{ 0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT,  D3DDECLUSAGE_NORMAL,   0},
	{ 0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT,  D3DDECLUSAGE_TEXCOORD, 0},
	{ 0, 32, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT,  D3DDECLUSAGE_TANGENT, 0},
	{ 0, 44, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT,  D3DDECLUSAGE_BINORMAL, 0},
	D3DDECL_END()
};
const unsigned int VertexNormUVTang::STRIDE_SIZE = sizeof(D3DXVECTOR3)*4 + sizeof(D3DXVECTOR2);
enum VERTEXTYPE VertexNormUVTang::VType = VERTEXTYPE::VT_POSNORMUVTANG;

const D3D11_INPUT_ELEMENT_DESC VertexNormUVTangSkinned::layout[7] =
{
	{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0,  0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	{ "NORMAL",   0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT,    0, 24, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	{ "TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT,    0, 32, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	{ "BINORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT,    0, 44, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	{ "BLENDINDICES", 0, DXGI_FORMAT_R32G32B32A32_FLOAT,    0, 56, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	{ "BLENDWEIGHT", 0, DXGI_FORMAT_R32G32B32A32_FLOAT,    0, 62, D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
const unsigned int VertexNormUVTangSkinned::STRIDE_SIZE = sizeof(D3DXVECTOR3)*4 + sizeof(D3DXVECTOR2) + sizeof(D3DXVECTOR4)*2;
enum VERTEXTYPE VertexNormUVTangSkinned::VType = VERTEXTYPE::VT_POSNORMUVTANG_SKIN;